package com.card.entity.manager;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.card.consts.GiftStatusConsts;
import com.card.entity.object.EntityObject;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * ClassName: SampleUser <br/>
 * Function: 样本数据. <br/>
 * date: 2018年12月11日 上午10:49:18 <br/>
 * 
 * @author lishuai11
 * @version
 * @since JDK 1.8
 */
@ApiModel
@Entity
@Table(name = "`USER_GIFT`")
@EntityListeners(AuditingEntityListener.class)
public class UserGift extends EntityObject {

	private static final long serialVersionUID = 2528890098805684542L;

	public UserGift() {
		super();
	}

	/**
	 * 
	 * 兑换码兑换
	 * 
	 * @param userId
	 * @param giftId
	 * @param number
	 * @param exchangeCode
	 */
	public UserGift(int userId, int giftId, int addressId, int number, String exchangeCode) {
		super();
		this.userId = userId;
		this.giftId = giftId;
		this.addressId = addressId;
		this.number = number;
		this.exchangeCode = exchangeCode;
		// 待发货
		this.status = GiftStatusConsts.READY_SEND;
	}

	/**
	 * 
	 * 积分兑换
	 * 
	 * @param userId
	 * @param giftId
	 * @param number
	 */
	public UserGift(int userId, int giftId, int addressId, int number) {
		super();
		this.userId = userId;
		this.giftId = giftId;
		this.addressId = addressId;
		this.number = number;
		// 待发货
		this.status = GiftStatusConsts.READY_SEND;
	}

	@ApiModelProperty(name = "userGiftId", value = "主键")
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "`USER_GIFT_ID`")
	private int userGiftId;

	@ApiModelProperty(name = "userId", value = "用户id")
	@Column(name = "`USER_ID`", nullable = false, updatable = false)
	private int userId;

	@ApiModelProperty(name = "giftId", value = "礼物id")
	@Column(name = "`GIFT_ID`", nullable = false, updatable = false)
	private int giftId;

	@ApiModelProperty(name = "addressId", value = "地址id")
	@Column(name = "`ADDRESS_ID`", nullable = false, updatable = false)
	private int addressId;

	@ApiModelProperty(name = "number", value = "礼物数量")
	@Column(name = "`NUMBER`", nullable = false)
	private int number;

	@ApiModelProperty(name = "exchangeCode", value = "兑换码:兑换码兑换只能使用一次")
	@Column(name = "`EXCHANGE_CODE`")
	private String exchangeCode;

	@ApiModelProperty(name = "status", value = "发货状态(1：待发货；2：已发货；3：已完成)")
	@Column(name = "`STATUS`", nullable = false)
	private int status;

	@ApiModelProperty(name = "giftName", value = "礼物名称")
	@Transient
	private String giftName;

	@ApiModelProperty(name = "giftImage", value = "礼物图片")
	@Transient
	private String giftImage;

	/**
	 * @return the userGiftId
	 */
	public int getUserGiftId() {
		return userGiftId;
	}

	/**
	 * @param userGiftId
	 *            the userGiftId to set
	 */
	public void setUserGiftId(int userGiftId) {
		this.userGiftId = userGiftId;
	}

	/**
	 * @return the userId
	 */
	public int getUserId() {
		return userId;
	}

	/**
	 * @param userId
	 *            the userId to set
	 */
	public void setUserId(int userId) {
		this.userId = userId;
	}

	/**
	 * @return the giftId
	 */
	public int getGiftId() {
		return giftId;
	}

	/**
	 * @param giftId
	 *            the giftId to set
	 */
	public void setGiftId(int giftId) {
		this.giftId = giftId;
	}

	/**
	 * @return the addressId
	 */
	public int getAddressId() {
		return addressId;
	}

	/**
	 * @param addressId
	 *            the addressId to set
	 */
	public void setAddressId(int addressId) {
		this.addressId = addressId;
	}

	/**
	 * @return the number
	 */
	public int getNumber() {
		return number;
	}

	/**
	 * @param number
	 *            the number to set
	 */
	public void setNumber(int number) {
		this.number = number;
	}

	/**
	 * @return the status
	 */
	public int getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            the status to set
	 */
	public void setStatus(int status) {
		this.status = status;
	}

	/**
	 * @return the giftName
	 */
	public String getGiftName() {
		return giftName;
	}

	/**
	 * @param giftName
	 *            the giftName to set
	 */
	public void setGiftName(String giftName) {
		this.giftName = giftName;
	}

	/**
	 * @return the giftImage
	 */
	public String getGiftImage() {
		return giftImage;
	}

	/**
	 * @param giftImage
	 *            the giftImage to set
	 */
	public void setGiftImage(String giftImage) {
		this.giftImage = giftImage;
	}

	/**
	 * @return the exchangeCode
	 */
	public String getExchangeCode() {
		return exchangeCode;
	}

	/**
	 * @param exchangeCode
	 *            the exchangeCode to set
	 */
	public void setExchangeCode(String exchangeCode) {
		this.exchangeCode = exchangeCode;
	}

}
